
function deadLoop(time) {
    var start = Date.now();
    console.log('死循环开始启动');
    while (Date.now() - start < time) {
    }
    var end = Date.now();
    // console.log('死循环结束', new Date().toISOString(), `(时间戳: ${end}, 耗时: ${end - start}ms)`);
}
// 打印当前时间,需要精确到毫秒
const startTime = Date.now();
console.log('开始执行', new Date().toISOString(), `(时间戳: ${startTime})`);
let count = 0;
setInterval(() => {
    console.log('定时器启动');
    deadLoop(10000);
    console.log('第', (count += 1), '次结束的时间', new Date().toISOString());
}, 5000);
